#include "led_manager.h"

void led_manager_init(LEDManager* manager, gpio_num_t pin) {
    // 设置LED引脚
    manager->pin = pin;

    gpio_config_t io_conf = {
        // 禁用中断
        .intr_type = GPIO_INTR_DISABLE,
        // 设置输出模式
        .mode = GPIO_MODE_OUTPUT,
        // 设置要配置的引脚
        .pin_bit_mask = (1ULL << pin),
        // 禁用下拉
        .pull_down_en = 0,
        // 禁用上拉
        .pull_up_en = 0
    };

    // 应用GPIO配置
    gpio_config(&io_conf);
}

void led_manager_set_level(LEDManager* manager, uint32_t level) {
    // 设置LED引脚的电平
    gpio_set_level(manager->pin, level);
}